翻訳と辞書
Words near each other
・ Bartonian
・ Bartonjo Rotich
・ Bartons Creek Township, Wake County, North Carolina
・ Bartons House, California
・ Bartonsville Covered Bridge
・ Bartonsville, Pennsylvania
・ Bartonsville, Virginia
・ Bartonville
・ Bartonville Agreement
・ Bartonville, Illinois
・ Bartonville, Missouri
・ Bartonville, Texas
・ Barton–Kellogg reaction
・ Barton–Lexa School District
・ Barton–McCombie deoxygenation
Barton–Nackman trick
・ Barton–Rush Bill
・ Barton–Zard reaction
・ Bartos/Nobel BN-1 Phantom
・ Bartosiewicz
・ Bartosy
・ Bartosz
・ Bartosz Arłukowicz
・ Bartosz Bednorz
・ Bartosz Bereszyński
・ Bartosz Białkowski
・ Bartosz Bosacki
・ Bartosz Brenes
・ Bartosz Broniszewski
・ Bartosz Chajdecki


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Barton–Nackman trick : ウィキペディア英語版
Barton–Nackman trick
Barton–Nackman trick is a term coined by the C++ standardization committee (ISO/IEC JTC1/SC22 WG21) to refer to an idiom introduced by John Barton and Lee Nackman as ''Restricted Template Expansion''.
==The idiom==

The idiom is characterized by an in-class friend function definition appearing in the base class template component of the Curiously Recurring Template Pattern (CRTP).

// A class template to express an equality comparison interface.
template class equal_comparable
};
// Class value_type wants to have == and !=, so it derives from
// equal_comparable with itself as argument (which is the CRTP).
class value_type : private equal_comparable ;

When a class template like equal_comparable is instantiated, the in-class friend definitions produce ''nontemplate'' (and nonmember) functions (operator functions in this case). At the time the idiom was introduced (1994) the C++ language did not define a partial ordering for overloaded function templates and as a result overloading function templates often resulted in ambiguities. For example, trying to capture a generic definition for operator== as

template
bool operator==(T const &a, T const &b)

would essentially be incompatible with another definition like

template
bool operator==(Array const &a, Array const &b)

The Barton–Nackman trick, then, achieves the goal of providing a generic user-defined equality operator without having to deal with such ambiguities. The adjective ''restricted'' in the idiom name refers to the fact that the provided in-class function definition is restricted (only applies) to specializations of the given class template.
The term is sometimes mistakenly used to refer to the Curiously Recurring Template Pattern (CRTP). As explained above, the Barton–Nackman trick is a distinct idiom (that relies on the CRTP).

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Barton–Nackman trick」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.